Skip to content

Conversation

@ryanabx
Copy link

@ryanabx ryanabx commented Oct 27, 2025

This PR is a work-in-progress! Give it a whirl if you feel adventurous ;)

Resolves: #1976

This PR was inspired by the discussion in the issue above.

Why an integrated terminal? Why not Tmux/Zellij/?

  • Windows support (Tmux and zellij don't support windows, and as I found out looking at zellij implementation would be very difficult)
  • Integrated terminals are more accessible to users (No need to install and configure a terminal multiplexer)
  • We can do further things like "clicking" (via keyboard or mouse) links to files in terminal output and jumping to that file.

Progress so far:
Screencast_20251026_224808.webm

What's left to work on?

  • Initial PTY handling
  • Split out relevant crates for helix-integrated-terminal to use (so helix-view doesn't have a cyclic dependency on helix-integrated-terminal
  • Wire in basic keyboard input support
  • Mouse support, clipboard support, advanced keyboard input support
  • Fix rendering glitches with the terminal
  • Ensure terminal is properly async (and also properly cleaned up after quitting helix)
  • Either make the terminal a pop-up (easy), or investigate embedding it into a View (hard)
  • Finalize keybindings
  • Cleanup

Feel free to contribute to the branch!

@ryanabx ryanabx changed the title feat: Add an integrated terminal. DRAFT: Add an integrated terminal. Oct 27, 2025
@ryanabx
Copy link
Author

ryanabx commented Oct 27, 2025

I also was thinking about whether a View should be extended to be either a DocumentView or a TerminalView which would allow us to make use of the current splits code for the terminal as well.

@gyreas
Copy link
Contributor

gyreas commented Oct 27, 2025

I also was thinking about whether a View should be extended to be either a DocumentView or a TerminalView which would allow us to make use of the current splits code for the terminal as well.

all views are splittable: https://github.com/helix-editor/helix/blob/master/docs%2Farchitecture.md, so yeah it makes sense

@ryanabx
Copy link
Author

ryanabx commented Oct 27, 2025

I also was thinking about whether a View should be extended to be either a DocumentView or a TerminalView which would allow us to make use of the current splits code for the terminal as well.

all views are splittable: https://github.com/helix-editor/helix/blob/master/docs%2Farchitecture.md, so yeah it makes sense

It makes sense to me, but a lot of the View code is inherently tied to Documents, including several macros. It can definitely be rewritten, but that'd make the PR touch a lot more stuff, and the maintainers may not like the direction that would take it. Just didn't want to work on that unless it seems like a good direction 🤷

@ryanabx
Copy link
Author

ryanabx commented Oct 27, 2025

Everything seems to expect views to be attached to documents, sadly. This makes it very difficult to make use of the existing view logic.

For example, after updating the macros to return options to conditionally give a view and document only if they are of type View::Document, and after fixing about 100 errors to presumably get rust-analyzer to the next step of error reporting. I get this beautiful number of errors.

image

Maybe the Document structure is what should be updated instead. Looking at that next

@AbeEstrada
Copy link

I have a genuine question.

What are the benefits of integrating a terminal into Helix?

When you can take advantage of the multiplexer that several terminals offer, or even tmux

helix.mp4

@ryanabx
Copy link
Author

ryanabx commented Oct 27, 2025

I have a genuine question.

What are the benefits of integrating a terminal into Helix?

When you can take advantage of the multiplexer that several terminals offer, or even tmux

That's a fine question. The main benefit for me is windows support. Zellij and tmux don't support windows (except in WSL). Also, having the terminal integrated allows us to do some cool stuff in the future like CTRL+Clicking a file link in an failed compilation to go to the file, line and col that the error references.

@ryanabx ryanabx force-pushed the pseudoterminal branch 2 times, most recently from 7c48a01 to f7cd3b4 Compare October 28, 2025 05:50
@ryanabx ryanabx force-pushed the pseudoterminal branch 2 times, most recently from 029ec3f to c17950f Compare October 28, 2025 15:03
@kiki-ala
Copy link

I don't think this makes sense or is needed
Clicking? This is helix...?

@ryanabx
Copy link
Author

ryanabx commented Oct 28, 2025

I don't think this makes sense or is needed Clicking? This is helix...?

There has historically been an interest in this feature, as can be found here.

I also have been interested in this feature for a while, so I decided to do some work to adapt the original PoC.

@wasinski
Copy link

I'd love to have "clickable" (by keyboard) file links!

@gyreas
Copy link
Contributor

gyreas commented Oct 30, 2025

I also was thinking about whether a View should be extended to be either a DocumentView or a TerminalView which would allow us to make use of the current splits code for the terminal as well.

what do you think about making View a trait and have the current implementation be DocumentView? Consider also a ViewController that handles events and data to View

but I'm afraid this will touch a lot of code, so it's better as a separate PR because for example, plugins may one day want to support views that aren't attached to a document

@ryanabx
Copy link
Author

ryanabx commented Oct 31, 2025

I also was thinking about whether a View should be extended to be either a DocumentView or a TerminalView which would allow us to make use of the current splits code for the terminal as well.

what do you think about making View a trait and have the current implementation be DocumentView? Consider also a ViewController that handles events and data to View

but I'm afraid this will touch a lot of code, so it's better as a separate PR because for example, plugins may one day want to support views that aren't attached to a document

View could be a trait or enum, I don't mind either of those. I would like approval from a maintainer that it'd be a good idea before I put in the work.

Also, some ideas on what to do about all the code that expects a view to always have a document would be nice. There are several macros that are used all around helix that would have to be updated. What's the cleanest way to decouple all this?

cc: @the-mikedavis

Also worth considering is a generic of some kind. I think the problem with traits is that if we don't redo the order of things (aka a document has a view, not the other way around), we end up with functions on the view that aren't usable without downcasting.

@NSPC911
Copy link

NSPC911 commented Nov 6, 2025

I can vouch for the Windows support. I have been stuck on Windows due to a multitude of reasons, but an issue I kept facing is a toggleable terminal. Wezterm does handle most of my multiplexing needs, aside from a popup terminal, or a toggleable terminal. I will try to get this running on my fork maybe this week, I have way too much PRs merged there 😅

@ryanabx
Copy link
Author

ryanabx commented Nov 6, 2025

I can vouch for the Windows support. I have been stuck on Windows due to a multitude of reasons, but an issue I kept facing is a toggleable terminal. Wezterm does handle most of my multiplexing needs, aside from a popup terminal, or a toggleable terminal. I will try to get this running on my fork maybe this week, I have way too much PRs merged there 😅

If you bring it in as-is, just a reminder you'll need to set the SHELL environment variable to the path to PowerShell. I haven't gotten around to handling how it will be configured other than that yet.

Also there are rendering glitches and stuff, but please don't hesitate to provide feedback! :)

This commit separates some primitives from `helix-view` into their own crates, for later use by crates that view might depend on, without causing cyclic dependencies.
@ryanabx ryanabx force-pushed the pseudoterminal branch 3 times, most recently from 006eecc to 4002219 Compare November 7, 2025 16:56
This commit adds the `helix-integrated-terminal` crate, which
handles the PTY creation and view logic for an integrated
terminal in Helix, using the `alacritty_terminal` crate.

The terminal can be opened using the `:term` command, and the
terminal can be exited by either using `exit` in the terminal
itself, or by using `C-q` twice.

The current implementation is as a pop-up, but in the future,
we may be able to expose the terminal as a `View`, if work is
done to decouple the `Document` attachment to `View`.

Signed-off-by: Ryan Brue <[email protected]>
@ryanabx ryanabx changed the title DRAFT: Add an integrated terminal. Work-In-Progress: Integrated Terminal ⚙ Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Proposal] Buitin support for Integrated Terminal

6 participants